<?php
$this->Html->addCrumb('Services');

//css
echo $this->Html->css(array('jquery.cluetip'), false);
//js
echo $this->Html->script(array('plugins/jquery.cluetip','plugins/jquery.cycle.all'), false);

$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $(".ad_logo img").each(function(index, value) {
        if($(this).attr("data-desc")){
          $(this).attr("title",$(this).attr("rel"));
           $(this).addClass("logo");
          }
        });
        $(".ad_logo img.logo").cluetip({ cluetipClass: "jtip", arrows: true, splitTitle : "|",  positionBy : "mouse" , topOffset : 20, leftOffset : 40,
          hoverIntent: {
            sensitivity:  30,
            interval: 300,
            timeout: 1000
          },
          fx :{open : "fadeIn", speed : "slow"},
          clickThrough : true
        });

        if($("#ad1 div.rotatingAd").size() > 0 || $("#ad2 div.rotatingAd").size()) {
          $("#adSection").show();
          $("#ad1").cycle({fx:"scrollRight", delay : -6000, timeout : 5000});
          $("#ad2").cycle({fx:"turnDown", timeout: 8000});
        }
      });
       ';
$this->Html->scriptEnd();
?>
<div>
  <h1 class="inline">Services for weddings in Trinidad and Tobago</h1>
  <?php if(empty($services)) { ?>
    <p>No services are currently available.</p>
  <?php } else {
    echo '<div id="servicesContainer" style="position: relative;">';
    foreach($services as $service) { $rec = $service['Service'];
    $thumb = !empty($rec['image_path']) ? $rec['image_path'] : Configure::read('App.servicesDefaultImage');
    ?>

    <div class="ad_logo"> <?php echo $this->Html->image($thumb, array('alt' => $rec['name'],'class'=>'center', 'rel'=>$rec['name'].'|'.$rec['description'], 'data-desc'=>$rec['description'], 'url'=>array('controller'=>'companies', 'action'=>'company_service',$rec['id'])))?>
      <div class="ad_logo_text"><span ><?php echo $rec['name'];?></span></div>
    </div>
  <?php }
  echo "</div>";

   echo $this->element('main_pagination');
  } ?>
</div>